package com.systop.scos.travel.webapp;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.systop.core.webapp.struts2.action.DefaultCrudAction;
import com.systop.scos.travel.model.Travel;
import com.systop.scos.travel.service.TravelManager;

@SuppressWarnings("serial")
@Controller
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class TravelAction extends DefaultCrudAction<Travel, TravelManager> {
	@Override
	public String save() {
		// 判断是否有重复名称
		if (getManager().getDao().exists(getModel(), "name")) {
			addActionError("类别名称已存在！");
			return INPUT;
		}
		return super.save();
	}
}
